import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

//       Scanner scanner = new Scanner(System.in);
//       int a = scanner.nextInt();
//       int b = scanner.nextInt();
//       int tmp = 0;
//       while((tmp = a % b )!=0)
//       {
//           a = b;
//           b = tmp;
//       }
//       System.out.println(b);

//        int a = 15;
//        int count = 0;
//        int flag = 0;
//        while(a != 0)
//        {
//            flag = a & 1;
//            if(flag == 1)
//            {
//                count++;
//            }
//            a = a >> 1;
//        }
//        System.out.println(count);

//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        int i = 0;
//        for(i=100;i<=n;i++)
//        {
//            int a = i / 100;
//            int b = (i / 10) % 10;
//            int c = i % 10;
//            if(i==a*a*a+b*b*b+c*c*c)
//                System.out.println(i+" ");
//        }

//        Scanner scanner = new Scanner(System.in);
//        int n = scanner.nextInt();
//        while(n!=0){
//            System.out.print(n%10+" ");
//            n = n/10;
//        }

//        Scanner scanner = new Scanner(System.in);
//        while(scanner.hasNext()){
//            int row = scanner.nextInt();
//            for(int i=1;i<=row;i++){
//                for(int j=1;j<=row;j++){
//                    if(i==j || i+j==row+1)
//                        System.out.print("*");
//                    else
//                        System.out.print(" ");
//                }
//                System.out.println();
//            }
//        }

//        int n = 0;
//        double sum = 0;
//        int flag = 1;
//        for(n = 1;n<=100;n++){
//            sum += (1.0 / n)*flag;
//            flag = -flag;
//        }
//        System.out.println(sum);

//        Random random = new Random();
//        Scanner scanner = new Scanner(System.in);
//        int toGuess = random.nextInt(100) + 1;
//        while(true){
//            System.out.println("Guess a number between 1 and 100: ");
//            int guess = scanner.nextInt();
//            if(guess == toGuess){
//                System.out.println("Congratulations, you guessed it!");
//                break;
//            }
//            else if(guess < toGuess){
//                System.out.println("Too low, try again.");
//            }
//            else {
//                System.out.println("Too high, try again.");
//            }
//        }

//        Random random = new Random();
//        Scanner scanner = new Scanner(System.in);
//        int toGuess = random.nextInt(1000) + 1;
//        while(true){
//            System.out.println("Guess a number between 1 and 100: ");
//            int guess = scanner.nextInt();
//            if(guess == toGuess){
//                System.out.println("Congratulations, you guessed it!");
//                break;
//            }
//            else if(guess < toGuess){
//                System.out.println("Too low, try again.");
//            }
//            else {
//                System.out.println("Too high, try again.");
//            }
//        }

        Scanner scanner = new Scanner(System.in);
        String password = "123456";
        String input = "";
        int n = 3;
        System.out.println("Enter 3 times to access system.");
        while(n != 0){
            System.out.println("Enter password to access system:");
            input = scanner.next();
            if(input.equals(password)){
                System.out.println("Access granted.");
                break;
            }
            else{
                System.out.println("Access denied.");
            }
            System.out.println("You have "+(n-1)+" times left to access system.");
            n--;
        }
        if(n == 0){
            System.out.println("You have no more times to access system.");
        }


    }
}